<template>
	<view id="domxee-content" :class="globalData.defaultThemes">
		<view id="header_wrapper" class="theme-main-bg-color color-white">
			<nii-navbar :globalData="globalData" :scroll="scroll" back>
				<!-- <view slot="back"></view> -->
				<view slot="title">{{renders.main_title}}</view>
				<!-- <view slot="tools"></view> -->
			</nii-navbar>
		</view>
		<view id="content_wraapper">
			<view class="theme-main-bg-color text-white">
				<view class="">
					<view class="d-flex flex-column a-center py-30">
						<view class="">
							销售收入
						</view>
						<view class="font-50">
							0.00
						</view>
					</view>
					<view class="d-flex j-sa a-center">
						<view class="d-flex flex-column a-center">
							<view class="font-24">
								以往利润
							</view>
							<view class="font-28">
								0
							</view>
						</view>
						<view class="d-flex flex-column a-center">
							<view class="d-flex flex-column a-center">
								<view class="font-24">
									待结算
								</view>
								<view class="font-28">
									0
								</view>
							</view>
							<view class="bg-f5f5f5 p-20 b-r48 position-relative" style="top: 50rpx;">
								<view class="theme-main-bg-color px-50 b-r48 font-26" style="height: 60rpx; line-height: 60rpx;">
									立即提现
								</view>
							</view>
						</view>
						<view class="d-flex flex-column a-center">
							<view class="font-24">
								累计利润
							</view>
							<view class="font-28">
								0
							</view>
						</view>
					</view>
				</view>
				
			</view>
			<view class="d-flex flex-wrap a-center j-sb px-16 mt-35"  style="">
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-erweima theme-main-color font-48"></view>
					<view class="pt-20">
						我的名片
					</view>
				</view>
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-youhuiquan color-ff433a font-48"></view>
					<view class="pt-20">
						客户统计
					</view>
				</view>
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-youhuiquan color-ff433a font-48"></view>
					<view class="pt-20">
						利润记录
					</view>
				</view>
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-youhuiquan color-ff433a font-48"></view>
					<view class="pt-20">
						收到利润
					</view>
				</view>
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-youhuiquan color-ff433a font-48"></view>
					<view class="pt-20">
						未结算利润
					</view>
				</view>
				
				<view class="bg-white b-r16 w-47 py-50 mx-8 mt-20 box-border d-flex flex-column a-center">
					<view class="iconfont icon-youhuiquan color-ff433a font-48"></view>
					<view class="pt-20">
						已撤销利润
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				globalData: {windowWidth: 0, statusBarHeight: 0, navHeight: 0, navigationBarHeight: 0, wechatCapsule: {width: 0, height: 0, top: 0, right: 0, bottom: 0, left: 0}, defaultThemes: [], colors: {}, configs: {} },
				scroll: 0,
				current_page: {route: '', params: {}, url: ''},
				ready: false,
				options: {

				},
				styles: {
					
				},
				shows: {
					services: false,
					autoShow: false
				},
				renders: {
					activity1: {enable: false, name: '', img: '', alias: 'none', params: {}},
					activity2: {enable: false, name: '', img: '', alias: 'none', params: {}},
					activity3: {enable: false, name: '', img: '', alias: 'none', params: {}},
					infos: {avatar: '', nickname: '', rows: [], mode_one_level_name: '', mode_three_level_name: '', idents: [], qr: {enable: false, text: '', alias: 'none', params: {}}},
					vip: {enable: false, text: '', button: '', alias: 'none', params: {}},
					ad: false, 
					statistics: {enable: false, lists: [{name: '', text: '', alias: 'none', params: {}}]},
					sections: {
						orders: {enable: false, title: '', more: '', alias: 'none', params: {}, lists: [{name: '', img: '', alias: 'none', params: {}, count: 0}]},
						fans: {enable: false, title: '', lists: [{enable: false, name: '', img: '', alias: 'none', params: {}}]},
						tools: {enable: false, title: '', lists: [{name: '', img: '', alias: 'none', params: {}}]},
						lists: {enable: false, title: '', lists: []},
					},
					popups: {
						autoShow: {enable: false, img: '', width: 0, height: 0, alias: 'none', params: {}, force: false},
						services: {title: '', lists: [], tel: ''},
					}
				},
				data: {
					sections: {

					},
				},
			}
		},
		onReady() {						//页面渲染完毕后操作（动态获取/调整元素宽高位置等需在ready后获取最为准确）
			//设置对象
			let that = this;

		},
		onShow() {						//页面显示后操作（关闭、后台运行等操作后重新打开访问触发、可在实时性较高操作页面进行全页刷新）
			//设置对象
			let that = this;
			//初始数据
			that.initInformation();
		},
		onLoad(options) {				//页面加载时操作（options可获取当前页面传递参数，如：options.id）
			//设置对象
			let that = this;
			//设置当前页面数据
			that.current_page = that.nii_common.pages.getCurrentUrl();
			//设置默认数据
			that.globalData = that.nii_common.pages.initGlobalData(getApp().globalData);
			//设置参数
			that.options = options;
			//初始数据
			that.initInformation();
		},
		methods: {
			//默认跳转操作
			navigateAction: function(alias, requestParams = {}, action = 'navigate', authenticate = false, animationType = 'slide-in-right') {this.nii_common.navigate.action(alias, requestParams, action, authenticate, animationType); },
			//拨打电话
			callPhone: function(mobile) {uni.makePhoneCall({phoneNumber: mobile});},
			//复制数据
			clipboardData: function (text) {const that = this;that.nii_common.clipboardData(text);},
			initInformation: function() {
				//设置对象
				let that = this;
				//loading
				!that.ready && that.nii_common.toastLoading('加载中');
				//开始准备
				that.ready = false;				
				//发起请求
				that.nii_common.request.build('teams/information', that.options, 'GET', function (res) {
					//设置准备已就绪
					that.ready = true;
					//设置数据
					that.renders = res.data;
					//判断是否开启自动弹窗
					// if (that.renders.popups.autoShow.enable) {
					// 	//打开弹窗
					// 	that.shows.autoShow = true;
					// }
				}, function (res) {
					//提示错误
					that.nii_common.toastAlert(res.msg);
				}, function(res) {
					//隐藏loading
					that.nii_common.toastLoadingHide();
				}, true);	
			},
			scanAction: function() {
				let that = this;
				console.log(1);
				// 允许从相机和相册扫码
				uni.scanCode({
					scanType: ['qrCode'],
					onlyFromCamera: false,
					success: function (res) {
						console.log(res);
						console.log('条码类型：' + res.scanType);
						console.log('条码内容：' + res.result);
						let url = res.result + '&type=gold';
						console.log(url);
						that.navigateAction(url, {}, '', true);
						// uni.navigateTo({
						// 	url: url
						// });
						// if(!uni.$u.test.isEmpty(res.result)){
						// 	uni.navigateTo({
						// 		url: res.result + '&type=gold'
						// 	});
						// }
					}
				});
			},
			// requestDemo: function() {
			// 	//获取对象
			// 	const that = this;
			// 	//loading
			// 	that.nii_common.toastLoading('处理中...');
			// 	//发起请求
			// 	that.nii_common.request.build('', {}, 'POST', function (res) {
			// 		//提示成功
			// 		that.nii_common.toastAlert('处理成功', 'success');
			// 	}, function (res) {
			// 		//提示错误
			// 		that.nii_common.toastAlert(res.msg);
			// 	}, function(res) {
			// 		//隐藏loading
			// 		that.nii_common.toastLoadingHide();
			// 	});	
			// }
		},
		onPullDownRefresh(res) {
			//设置对象
			let that = this;
			
			//TODO：页面下拉刷新时的事件
			
			
			//停止刷新
			uni.stopPullDownRefresh();	
		},
		onReachBottom() {
			//设置对象
			let that = this;
			
			//TODO：页面滑动触底时的事件
			
		},
		onPageScroll: function(e) {
			//设置页面滑动高度
			this.scroll = e.scrollTop

			//TODO：需判断滑动高度后处理的事件

		}
	}

</script>

<style lang="scss">
	page{
		background-color: #f5f5f5;
	}
	
</style>
